﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace BiliBiliCSharpStudy.old {
    class NewDemo {
        public static void demo() {
            //test1();
            //test2();
            //test3();
            //test4();
            //test5();
            test6();
        }

        public static void test6() {
            // 这里的 new 是操作符
            Student1 stu = new Student1();
            stu.Report();
            CsStudent stu1 = new CsStudent();
            stu1.Report();
        }

        public static void test5() {
            // 匿名类型
            var person = new { Name = "Mr.Okay", Age = 34 };
            Console.WriteLine(person.Name);
            Console.WriteLine(person.Age);

            // output: <>f__AnonymousType0`2
            Console.WriteLine(person.GetType().Name);
        }

        public static void test4() {
            int x = 100;
            string name = "Tim";
            //string name1 = new string();
            int[] myArray = new int[3] { 1, 2, 3 };
            int[] myArray2 = { 1, 2, 3 };
        }

        public static void test3() {
            new Form() { Text = "hello" }.ShowDialog();
        }

        public static void test2() {
            Form form = new Form() { Text = "Hello World", FormBorderStyle = FormBorderStyle.SizableToolWindow };
            form.ShowDialog();
        }

        public static void test1() {
            Form form = new Form();
            form.Text = "Hello";
            form.ShowDialog();
        }
    }

    class Student1 {
        public void Report() {
            Console.WriteLine("I'm a student.");
        }
    }

    class CsStudent : Student1 {
        // new 在这里是修饰符
        new public void Report() {
            Console.WriteLine("I'm a CS student.");
        }
    }
}
